﻿using System;

namespace Eflong.Structure
{
    public class PacketAck
    {
        public const string LOGIN_PACKET = "login";
        public const string LOGOUT_PACKET = "logout";
        public const string DEFINE_PACKET = "DefinePacket";
        public const string DATA_PACKET = "DataPacket";

        public PacketAck( Packet packet )
        {
            packetOut = new Packet( packet.GetDataSize( ) , packet.GetpData( ) );
            m_dwId = packet.m_dwId;
        }

        public uint m_dwId;

        public string packetType { set; get; }

        public uint type { get; set; }

        public Packet packetIn { set; get; }

        public Packet packetOut { set; get; }

        ~PacketAck( )
        {
            Dispose( false );
        }

        public void Dispose( )
        {
            Dispose( true );

            GC.SuppressFinalize( this );
        }

        protected virtual void Dispose( bool disposing )
        {
            if ( disposing )
            {
                // 这里是清理"托管资源"的用户代码段
                if ( packetIn != null )
                {
                    packetIn.Dispose( );
                }
                if ( packetOut != null )
                {
                    packetOut.Dispose( );
                }
            }

            // 这里是清理"非托管资源"的用户代码段
        }
    }
}